/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 22652
 * Date: 2024-03-31
 * Time: 21:29
 */
public class test_4 {
    public static boolean finalIsQuit = false;
    public static void main(String[] args) throws InterruptedException {
        System.out.println(finalIsQuit);
        Thread t =new Thread(()->{
            System.out.println("在t里"+finalIsQuit);
            while (!finalIsQuit){
                System.out.println("通过共享的标记来进行沟通");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    System.out.println("00000000000");
                }
            }
        });
        t.start();
        Thread.sleep(3000);
        finalIsQuit = true;
        System.out.println("t结束");
    }
}
